﻿using System.Windows.Forms;

namespace GuidanceExplorerAddIn.Controls
{
    /// <summary>
    /// Custom grid view that handles header click event to disable column ordering when filtering
    /// </summary>
    class FilteredGridView : DataGridView
    {
        protected override void OnColumnHeaderMouseClick(DataGridViewCellMouseEventArgs e)
        {
            DatagridViewFilterHeaderCell filterHeader = Columns[e.ColumnIndex].HeaderCell as DatagridViewFilterHeaderCell;
            if (filterHeader != null && filterHeader.ImageHit(e))
            {
                return;
            }
            base.OnColumnHeaderMouseClick(e);
        }
    }
}
